<?php
/**
 * User: 苏翔
 * Date: 2024/8/11 19:01
 */

namespace App\Service;

use App\Dao\HscoinBalanceDao;
use App\Dao\HscoinBillDao;
use App\Dao\PriceLogDao;
use App\HscoinConf;

use Hyperf\Di\Annotation\Inject;


/**
 * @method getPrice()
 * @method cancel(int $category, int $link_id)
 * @method getList($uid = 0, $category = 0, $min_id = 0, $max_id = 0, $size = 10)
 */
class PriceLogService extends BaseService
{

    #[Inject]
    protected PriceLogDao $dao;


    function changeByHscoin($amount, $id=0)
    {
        return $this->dao->changeByHscoin($amount, $id);
    }

    function getPriceInfo()
    {
        $rs = $this->dao->getModel()->orderBy('id', 'desc')
            ->first(['fund_balance', 'hscoin_balance', 'price']);
         return $rs ? $rs->toArray() : [];
    }



    function changeByFund($amount, $id=0)
    {
        return $this->dao->changeByFund($amount, $id);
    }
}